home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / movement / Wings.lua < prev   
Text File  |  2009-12-01  |  2KB  |  63 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon Wings
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, November 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.wings={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.wings.gfx_wpn=loadgfx("weapons/wings0.bmp")                        -- Weapon (Image Frame 1)
  13. setmidhandle(cc.wings.gfx_wpn)
  14. cc.wings.gfx_wpn2=loadgfx("weapons/wings1.bmp")                        -- Weapon (Image Frame 2)
  15. setmidhandle(cc.wings.gfx_wpn2)
  16. cc.wings.sfx_wings=loadsfx("flap.ogg")                                -- Sound
  17.  
  18. --------------------------------------------------------------------------------
  19. -- Weapon: Wings
  20. --------------------------------------------------------------------------------
  21.  
  22. cc.wings.id=addweapon("cc.wings","Wings",cc.wings.gfx_wpn,0)        -- Add Weapon (0 uses)
  23.  
  24. function cc.wings.draw()                                            -- Draw
  25.     if getframesleft()>1 and weapon_shots>0 then
  26.         -- Setup draw mode
  27.         setblend(blend_alpha)
  28.         setalpha(1)
  29.         setcolor(255,255,255)
  30.         setscale(1,1)
  31.         setrotation(0)
  32.         -- Draw
  33.         if weapon_timer>=10 then
  34.             drawimage(cc.wings.gfx_wpn2,getplayerx(0)-1,getplayery(0))
  35.         else
  36.             drawimage(cc.wings.gfx_wpn,getplayerx(0)-1,getplayery(0))
  37.         end
  38.     end
  39.     -- HUD Crosshair
  40.     hudcrosshair(6,3)
  41. end
  42.  
  43. function cc.wings.attack(attack)                                    -- Attack
  44.     if weapon_timer>0 then
  45.         weapon_timer=weapon_timer-1
  46.     end
  47.     if (attack==1) and (weapon_timer<=0) then
  48.         -- Use weapon and allow to use another one afterwards (1)
  49.         useweapon(1)
  50.         weapon_shots=weapon_shots+1
  51.         weapon_timer=20
  52.         -- FX
  53.         playsound(cc.wings.sfx_wings)
  54.         -- Push (absolute, don't push others)
  55.         playerpush(0,math.sin(math.rad(getplayerrotation(0)))*3.0,-math.cos(math.rad(getplayerrotation(0)))*3.0-3.0,1,0)
  56.     end
  57.     if weapon_shots>0 then
  58.         -- Avoid Falldamage / Limit Fall speed
  59.         if getplayeryspeed(0)>4.0 then
  60.             playerpush(0,getplayerxspeed(0),4.0,1,0)
  61.         end
  62.     end
  63. end